package com.minimalist.common.entity.basic.po;

import com.mybatisflex.annotation.Table;


import java.io.Serial;
import java.io.Serializable;

/**
 * 角色与权限关联表 1角色-N权限 实体类。
 *
 * @author 小太阳
 * @since 2024-10-18
 */

@Table(value = "m_role_perm")
public class MRolePerm implements Serializable{

    public MRolePerm() {
    }

    public MRolePerm(Long roleId, Long permId) {
        this.roleId = roleId;
        this.permId = permId;
    }

    public Long getRoleId() {
        return roleId;
    }

    public void setRoleId(Long roleId) {
        this.roleId = roleId;
    }

    public Long getPermId() {
        return permId;
    }

    public void setPermId(Long permId) {
        this.permId = permId;
    }

    public static MRolePermBuilder builder() {
        return new MRolePermBuilder();
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        MRolePerm mRolePerm = (MRolePerm) o;
        return java.util.Objects.equals(roleId, mRolePerm.roleId) &&
               java.util.Objects.equals(permId, mRolePerm.permId);
    }

    @Override
    public int hashCode() {
        return java.util.Objects.hash(roleId, permId);
    }

    public static class MRolePermBuilder {
        private Long roleId;
        private Long permId;

        public MRolePermBuilder roleId(Long roleId) {
            this.roleId = roleId;
            return this;
        }

        public MRolePermBuilder permId(Long permId) {
            this.permId = permId;
            return this;
        }

        public MRolePerm build() {
            return new MRolePerm(roleId, permId);
        }
    }

    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * 角色ID
     */
    private Long roleId;

    /**
     * 权限ID
     */
    private Long permId;

}
